package com.zzxx.exam.test;

import javax.swing.*;
import java.awt.*;

public class BorderLayoutDemo {
    public static void main(String[] args) {
        JFrame win = new JFrame();
        JPanel jpa = new JPanel();

        jpa.setLayout(new BoxLayout(new Container(), BoxLayout.PAGE_AXIS));

        JButton j1 = new JButton("1");
        JButton j2 = new JButton("2");
        JButton j3 = new JButton("3");
        JButton j4 = new JButton("4");
        JButton j5 = new JButton("5");

        jpa.add(j1,BorderLayout.EAST);
        jpa.add(j2,BorderLayout.WEST);
        jpa.add(j3,BorderLayout.SOUTH);
        jpa.add(j4,BorderLayout.NORTH);
        jpa.add(j5,BorderLayout.CENTER);

//        jpa.add(j1,BoxLayout.X_AXIS);
//        jpa.add(j2,BorderLayout.WEST);
//        jpa.add(j3,BorderLayout.SOUTH);
//        jpa.add(j4,BorderLayout.NORTH);
//        jpa.add(j5,BorderLayout.CENTER);

        win.add(jpa);
        win.setSize(400,300);
        win.setVisible(true);
    }
}
